package com.znh.kuiklyuniversity.compose.widgets

import androidx.compose.runtime.Composable
import com.tencent.kuikly.compose.foundation.layout.Arrangement
import com.tencent.kuikly.compose.foundation.layout.Box
import com.tencent.kuikly.compose.foundation.layout.ExperimentalLayoutApi
import com.tencent.kuikly.compose.foundation.layout.FlowRow
import com.tencent.kuikly.compose.foundation.layout.Row
import com.tencent.kuikly.compose.foundation.layout.fillMaxWidth
import com.tencent.kuikly.compose.foundation.layout.height
import com.tencent.kuikly.compose.foundation.layout.padding
import com.tencent.kuikly.compose.foundation.layout.width
import com.tencent.kuikly.compose.foundation.lazy.LazyRow
import com.tencent.kuikly.compose.material3.Text
import com.tencent.kuikly.compose.resources.InternalResourceApi
import com.tencent.kuikly.compose.ui.Alignment
import com.tencent.kuikly.compose.ui.Modifier
import com.tencent.kuikly.compose.ui.unit.dp
import com.tencent.kuikly.compose.ui.unit.sp
import com.tencent.kuikly.core.base.BorderStyle
import com.znh.kuiklyuniversity.Border
import com.znh.kuiklyuniversity.Modal
import com.znh.kuiklyuniversity.border
import com.znh.kuiklyuniversity.borderRadius
import com.znh.kuiklyuniversity.compose.selfenum.AppColor

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun BarAndTotal() {
    var listTitle: ArrayList<String> = arrayListOf(
        "满300减30",
        "满100减50",
        "满100减70",
        "满300减30",
        "满100减50",
        "满100减70",
        "满300减30",
        "满100减50",
        "满100减70"
    )

    Row(modifier = Modifier.fillMaxWidth()) {
        Box(
            modifier = Modifier
                .fillMaxWidth()
                .weight(1f),
            contentAlignment = Alignment.CenterEnd
        ) {
            LazyRow {
                items(listTitle.size) { index ->
                    Box(
                        contentAlignment = Alignment.Center,
                        modifier = Modifier
                            .padding(end = 10.dp)
                            .borderRadius(3.dp)
                            .height(36.dp)
                            .border(
                                Border(
                                    lineStyle = BorderStyle.DASHED,
                                    lineWidth = 1.dp,
                                    color = AppColor.TxtRedColor.color
                                )
                            )
                    ) {
                        Text(
                            listTitle.get(index),
                            modifier = Modifier.padding(
                                start = 10.dp,
                                end = 10.dp,
                                top = 5.dp,
                                bottom = 5.dp
                            ),
                            fontSize = 14.sp,
                            color = AppColor.TxtCom.color
                        )
                    }
                }
            }
        }
//        FlowRow(
//            modifier = Modifier
//                .fillMaxWidth()
//                .weight(1f),
//            maxLines = 1,
//            maxItemsInEachRow = 5,
//            horizontalArrangement = Arrangement.spacedBy(8.dp),
//        ) {
//            repeat(listTitle.size) {
//                Box(
//                    contentAlignment = Alignment.Center,
//                    modifier = Modifier
//                        .borderRadius(3.dp)
//                        .height(36.dp)
//                        .border(
//                            Border(
//                                lineStyle = BorderStyle.DASHED,
//                                lineWidth = 1.dp,
//                                color = AppColor.TxtRedColor.color
//                            )
//                        )
//                ) {
//                    Text(
//                        listTitle.get(it),
//                        modifier = Modifier.padding(
//                            start = 10.dp,
//                            end = 10.dp,
//                            top = 5.dp,
//                            bottom = 5.dp
//                        ),
//                        fontSize = 14.sp,
//                        color = AppColor.TxtCom.color
//                    )
//                }
//            }
//        }
        Box(
            contentAlignment = Alignment.Center,
            modifier = Modifier
                .borderRadius(3.dp)
                .padding(start = 10.dp)
                .height(36.dp)
//                .border(
//                    Border(
//                        lineStyle = BorderStyle.DASHED,
//                        lineWidth = 1.dp,
//                        color = AppColor.BgSelColor.color
//                    )
//                )
        ) {
            Text(
                "全部>",
                fontSize = 14.sp,
                color = AppColor.TxtRedColor.color,
                modifier = Modifier.padding(start = 10.dp, end = 10.dp, top = 5.dp, bottom = 5.dp),
            )
        }
    }

}